Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JDK-version dependent code out of the compiler bridge #327

Merged
merged 1 commit into from
Jun 30, 2017

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Jun 30, 2017

On both my local machine and on Drone box, ZincComponentCompilerSpec fails to compile 2.10 compiler bridge with the following error:

/T/sbt_1234/xsbti/compile/CompilerBridgeProvider.java:33: error: `;' expected but `{' found.
    static CompilerBridgeProvider constant(File file, ScalaInstance scalaInstance) {
                                                                                   ^

I suspected that this is due to Java interface defining a static method, a change introduced in only in Java 8.
After making this change, the spec passed the test.

notes

Can target JDK 1.5, 1.6 and 1.7

The Scala 2.11.x series targets Java 6, with (evolving) experimental support for Java 8. In 2.11.0, Java 8 support is mostly limited to reading Java 8 bytecode and parsing Java 8 source.

Would it be reasonable to think that Scala 2.10 cannot parse Java 8 source?

On both my local machine and on Drone box, `ZincComponentCompilerSpec` fails to compile 2.10 compiler bridge with the following error:

```
/T/sbt_1234/xsbti/compile/CompilerBridgeProvider.java:33: error: `;' expected but `{' found.
    static CompilerBridgeProvider constant(File file, ScalaInstance scalaInstance) {
                                                                                   ^
```

I suspected that this is due to Java `interface` defining a static method, a change introduced in only in Java 8.
After making this change, the spec passed the test.
@eed3si9n eed3si9n mentioned this pull request Jun 30, 2017
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch.

Just to make it clearer for future readers of this PR, the issue happens in Scala's Java parser that is not capable of parsing statics in interfaces (only introduced in JDK8). Therefore, from now on, we should try to keep JDK version-dependent code out of the bridge, as this PR does.

@jvican jvican changed the title Move CompilerBridgeProvider.constant into ZincCompilerUtil Remove JDK-version dependent code out of the compiler bridge Jun 30, 2017
@typesafe-tools
Copy link

dbuild has checked the following projects against Scala 2.12:

Project Reference Commit
sbt 1.0.x sbt/sbt@25d393b
zinc pull/327/head 82cdf80
io 1.0 sbt/io@177ba25
librarymanagement 1.0 sbt/librarymanagement@7e87603
util 1.0 sbt/util@54cf4a4
website 1.0.x sbt/website@5c32a0a

❌ The result is: FAILED
(restart)

@eed3si9n
Copy link
Member Author

Dbuild validation won't work because it currently depends on sbt versions lined up to sbt 1.0.0-M6.

@eed3si9n
Copy link
Member Author

I rebased #323 (sbt 1.0.0-M6 bump) on top of this PR, and was able to get Dbuild to pass, so this PR too is validated.

@dwijnand dwijnand merged commit d7ddfe8 into sbt:1.0 Jun 30, 2017
@eed3si9n eed3si9n deleted the wip/brdige-problem branch June 30, 2017 18:23
cunei pushed a commit to cunei/zinc that referenced this pull request Oct 25, 2017
This reverts commit 3293819.

This resolves issue sbt#327. The packageBin clean hack will be
replaced with a release script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants